
const errorMiddleware = (error,req,res,next)=>{
     //错误处理逻辑
     // console.log(error);

     const status=error.status||500
     const message=error.message||'服务端错误'
     const errors=error.errors||'server wrong'

     res
     .status(status)
     .json({
          status:0,
          message,
          errors
     })

}

module.exports  = errorMiddleware